Apologies for the unintelligible question. Basically I am asking if the Kanalog opto I/O's are still useable with Mach3 when the MUX bit is set to send the step/dir 0 through 3 to JP4 and JP6 to run my Geckodrives. Mach "sees" them until I enable the axis. I'll expand on the question based on your answer. Attached is the test C program I am using.
Thanks for the help.
Rick
#include "KMotionDef.h"
// Defines axis 0 and 1 as simple steppers
// enables them
// sets them as an xy coordinate system for GCode
int main()
{
FPGA(STEP_PULSE_LENGTH_ADD)=32 + 0x40;
ch0->InputMode=ENCODER_MODE;
ch0->OutputMode=CL_STEP_DIR_MODE;
ch0->Vel=66000;
ch0->Accel=15259;
ch0->Jerk=6.6e+006;
ch0->P=0;
ch0->I=0;
ch0->D=0;
ch0->FFAccel=0;
ch0->FFVel=0;
ch0->MaxI=200;
ch0->MaxErr=200;
ch0->MaxOutput=200;
ch0->DeadBandGain=1;
ch0->DeadBandRange=0;
ch0->InputChan0=0;
ch0->InputChan1=1;
ch0->OutputChan0=0;
ch0->OutputChan1=1;
ch0->MasterAxis=-1;
ch0->LimitSwitchOptions=0x8f0024;
ch0->InputGain0=-3;
ch0->InputGain1=1;
ch0->InputOffset0=0;
ch0->InputOffset1=0;
ch0->OutputGain=-1;
ch0->OutputOffset=0;
ch0->SlaveGain=1;
ch0->BacklashMode=BACKLASH_OFF;
ch0->BacklashAmount=0;
ch0->BacklashRate=0;
ch0->invDistPerCycle=1;
ch0->Lead=0;
ch0->MaxFollowingError=1000000000;
ch0->StepperAmplitude=250;
ch0->iir[0].B0=1;
ch0->iir[0].B1=0;
ch0->iir[0].B2=0;
ch0->iir[0].A1=0;
ch0->iir[0].A2=0;
ch0->iir[1].B0=1;
ch0->iir[1].B1=0;
ch0->iir[1].B2=0;
ch0->iir[1].A1=0;
ch0->iir[1].A2=0;
ch0->iir[2].B0=1;
ch0->iir[2].B1=0;
ch0->iir[2].B2=0;
ch0->iir[2].A1=0;
ch0->iir[2].A2=0;
/*ch0->InputMode=ENCODER_MODE;
ch0->OutputMode=STEP_DIR_MODE;
ch0->Vel= 66000.000000;
ch0->Accel=660000.000000;
ch0->Jerk=6600000.000000;
ch0->P=1.000000;
ch0->I=0.000000;
ch0->D=0.000000;
ch0->FFAccel=0.000000;
ch0->FFVel=0.000000;
ch0->MaxI=200.000000;
ch0->MaxErr=200.000000;
ch0->MaxOutput=200.000000;
ch0->DeadBandGain=1.000000;
ch0->DeadBandRange=0.000000;
ch0->InputChan0=0;
ch0->InputChan1=1;
ch0->OutputChan0=0;
ch0->OutputChan1=1;
ch0->LimitSwitchOptions=0x0;
ch0->InputGain0=1.000000;
ch0->InputGain1=1.000000;
ch0->InputOffset0=0.000000;
ch0->InputOffset1=0.000000;
ch0->invDistPerCycle=1.000000;
ch0->Lead=0.000000;
ch0->MaxFollowingError=1000000000.000000;
ch0->StepperAmplitude=250.000000;
ch0->iir[0].B0=1.000000;
ch0->iir[0].B1=0.000000;
ch0->iir[0].B2=0.000000;
ch0->iir[0].A1=0.000000;
ch0->iir[0].A2=0.000000;
ch0->iir[1].B0=1.000000;
ch0->iir[1].B1=0.000000;
ch0->iir[1].B2=0.000000;
ch0->iir[1].A1=0.000000;
ch0->iir[1].A2=0.000000;
ch0->iir[2].B0=1.000000;
ch0->iir[2].B1=0.000000;
ch0->iir[2].B2=0.000000;
ch0->iir[2].A1=0.000000;
ch0->iir[2].A2=0.000000;
EnableAxisDest(0,0);*/
ch1->InputMode=ENCODER_MODE;
ch1->OutputMode=CL_STEP_DIR_MODE;
ch1->Vel=66000;
ch1->Accel=15259;
ch1->Jerk=6.6e+006;
ch1->P=0;
ch1->I=0;
ch1->D=0;
ch1->FFAccel=0;
ch1->FFVel=0;
ch1->MaxI=200;
ch1->MaxErr=20000;
ch1->MaxOutput=200;
ch1->DeadBandGain=1;
ch1->DeadBandRange=0;
ch1->InputChan0=1;
ch1->InputChan1=2;
ch1->OutputChan0=1;
ch1->OutputChan1=1;
ch1->MasterAxis=-1;
ch1->LimitSwitchOptions=0x0;
ch1->InputGain0=3;
ch1->InputGain1=1;
ch1->InputOffset0=0;
ch1->InputOffset1=0;
ch1->OutputGain=1;
ch1->OutputOffset=0;
ch1->SlaveGain=1;
ch1->BacklashMode=BACKLASH_OFF;
ch1->BacklashAmount=0;
ch1->BacklashRate=0;
ch1->invDistPerCycle=1;
ch1->Lead=0;
ch1->MaxFollowingError=1000000000;
ch1->StepperAmplitude=250;
ch1->iir[0].B0=1;
ch1->iir[0].B1=0;
ch1->iir[0].B2=0;
ch1->iir[0].A1=0;
ch1->iir[0].A2=0;
ch1->iir[1].B0=1;
ch1->iir[1].B1=0;
ch1->iir[1].B2=0;
ch1->iir[1].A1=0;
ch1->iir[1].A2=0;
ch1->iir[2].B0=1;
ch1->iir[2].B1=0;
ch1->iir[2].B2=0;
ch1->iir[2].A1=0;
ch1->iir[2].A2=0;
/*ch1->InputMode=ENCODER_MODE;
ch1->OutputMode=CL_STEP_DIR_MODE;
ch1->Vel=100.000000;
ch1->Accel=1000.000000;
ch1->Jerk=10000.000000;
ch1->P=0.000000;
ch1->I=0.000000;
ch1->D=0.000000;
ch1->FFAccel=0.000000;
ch1->FFVel=0.000000;
ch1->MaxI=200.000000;
ch1->MaxErr=200.000000;
ch1->MaxOutput=200.000000;
ch1->DeadBandGain=1.000000;
ch1->DeadBandRange=0.000000;
ch1->InputChan0=1;
ch1->InputChan1=2;
ch1->OutputChan0=2;
ch1->OutputChan1=3;
ch1->LimitSwitchOptions=0x0;
ch1->InputGain0=1.000000;
ch1->InputGain1=1.000000;
ch1->InputOffset0=0.000000;
ch1->InputOffset1=0.000000;
ch1->invDistPerCycle=1.000000;
ch1->Lead=0.000000;
ch1->MaxFollowingError=1000000000.000000;
ch1->StepperAmplitude=250.000000;
ch1->iir[0].B0=1.000000;
ch1->iir[0].B1=0.000000;
ch1->iir[0].B2=0.000000;
ch1->iir[0].A1=0.000000;
ch1->iir[0].A2=0.000000;
ch1->iir[1].B0=1.000000;
ch1->iir[1].B1=0.000000;
ch1->iir[1].B2=0.000000;
ch1->iir[1].A1=0.000000;
ch1->iir[1].A2=0.000000;
ch1->iir[2].B0=1.000000;
ch1->iir[2].B1=0.000000;
ch1->iir[2].B2=0.000000;
ch1->iir[2].A1=0.000000;
ch1->iir[2].A2=0.000000;*/
EnableAxisDest(1,0);
ch2->InputMode=ENCODER_MODE;
ch2->OutputMode=CL_STEP_DIR_MODE;
ch2->Vel=4000;
ch2->Accel=4000;
ch2->Jerk=4e+006;
ch2->P=0;
ch2->I=0;
ch2->D=0;
ch2->FFAccel=0;
ch2->FFVel=0;
ch2->MaxI=200;
ch2->MaxErr=1e+006;
ch2->MaxOutput=200;
ch2->DeadBandGain=1;
ch2->DeadBandRange=0;
ch2->InputChan0=2;
ch2->InputChan1=0;
ch2->OutputChan0=2;
ch2->OutputChan1=0;
ch2->MasterAxis=-1;
ch2->LimitSwitchOptions=0x0;
ch2->InputGain0=-1;
ch2->InputGain1=1;
ch2->InputOffset0=0;
ch2->InputOffset1=0;
ch2->OutputGain=-1;
ch2->OutputOffset=0;
ch2->SlaveGain=1;
ch2->BacklashMode=BACKLASH_OFF;
ch2->BacklashAmount=0;
ch2->BacklashRate=0;
ch2->invDistPerCycle=1;
ch2->Lead=0;
ch2->MaxFollowingError=1000000000;
ch2->StepperAmplitude=20;
ch2->iir[0].B0=1;
ch2->iir[0].B1=0;
ch2->iir[0].B2=0;
ch2->iir[0].A1=0;
ch2->iir[0].A2=0;
ch2->iir[1].B0=1;
ch2->iir[1].B1=0;
ch2->iir[1].B2=0;
ch2->iir[1].A1=0;
ch2->iir[1].A2=0;
ch2->iir[2].B0=0.000769;
ch2->iir[2].B1=0.001538;
ch2->iir[2].B2=0.000769;
ch2->iir[2].A1=1.92081;
ch2->iir[2].A2=-0.923885;
/*ch2->InputMode=ENCODER_MODE;
ch2->OutputMode=MICROSTEP_MODE;
ch2->Vel=100.000000;
ch2->Accel=1000.000000;
ch2->Jerk=10000.000000;
ch2->P=1.000000;
ch2->I=0.000000;
ch2->D=0.000000;
ch2->FFAccel=0.000000;
ch2->FFVel=0.000000;
ch2->MaxI=200.000000;
ch2->MaxErr=200.000000;
ch2->MaxOutput=200.000000;
ch2->DeadBandGain=1.000000;
ch2->DeadBandRange=0.000000;
ch2->InputChan0=2;
ch2->InputChan1=3;
ch2->OutputChan0=4;
ch2->OutputChan1=5;
ch2->LimitSwitchOptions=0x0;
ch2->InputGain0=1.000000;
ch2->InputGain1=1.000000;
ch2->InputOffset0=0.000000;
ch2->InputOffset1=0.000000;
ch2->invDistPerCycle=1.000000;
ch2->Lead=0.000000;
ch2->MaxFollowingError=1000000000.000000;
ch2->StepperAmplitude=250.000000;
ch2->iir[0].B0=1.000000;
ch2->iir[0].B1=0.000000;
ch2->iir[0].B2=0.000000;
ch2->iir[0].A1=0.000000;
ch2->iir[0].A2=0.000000;
ch2->iir[1].B0=1.000000;
ch2->iir[1].B1=0.000000;
ch2->iir[1].B2=0.000000;
ch2->iir[1].A1=0.000000;
ch2->iir[1].A2=0.000000;
ch2->iir[2].B0=1.000000;
ch2->iir[2].B1=0.000000;
ch2->iir[2].B2=0.000000;
ch2->iir[2].A1=0.000000;
ch2->iir[2].A2=0.000000;*/
EnableAxisDest(2,0);
DefineCoordSystem(0,1,2,-1);
return 0;
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Rick,
> Â
> I'm not sure I follow all that. Maybe you might post your files. If anything configures the Step/Dir generators or IO on JP7 then Kanalog will probably stop functioning. Does the charge pump LED on Kanalog go off when you enable the axis?
> Â
> Â
> Regards
> TK
>
> From: rdabs54 <rdabney@...>
> To: DynoMotion@yahoogroups.com
> Sent: Sunday, September 9, 2012 6:45 PM
> Subject: [DynoMotion] opto inputs inop with mach
>
>
> Â
> Greetings. I'm trying to finish setting up Kflop and Kanalog with Mach. I asked this question once before, but got on to other projects. This is a little more specific.
> Build 427
> What works: Three Geckos properly drive servos on a Bridgeport, three axis, CL with glass scales. (more on that in a different post). MUX bit set so step/dir goes to JP4 and 6, and placed at the beginning of the code. I can jog from Mach or Kmotion, with exceptions below.
> Before loading C file, Kanalog reads the switches on opto in 142 and 143 fine. After loading C file, but before enabling axis (done manually, axis enable remarked out), kanalog continues to read opto state as well as mach (input config set at port 2, pin 14 and 15). When axis enabled, switch indication ceases on Mach and Kanalog. Also, Axis (1) will estop within a few hundred steps. Sometimes impossible to reset unless I run a step/response check (works fine). Then I can reset. I changed the estop bit in mach to 30 (unused), then it works fine, though no switch is yet connected to 30.
> The C file is pretty much what is supplied as an example, with only the parameters changed for the step/dir operation.
> I tried several iteration of the code, but setting MUX bit always kills opto inputs, and lets step/dir work. I really want to use the opto inputs on the board so I don't have to build another opto interface.
> I'm using Mach 3.043.022, Windows 7 professional, no bloatware. Mach and Kmotion reinstalled twice. Kflop/Kanalog powered by good quality 5V 2A linear supply.
> I'm stuck. Help, Please.
>
> Thanks in Advance,
>
> rick
>